#!/bin/bash
AA=`iostat -dxk 1 1 | awk '{print $1}' | egrep -v '(Linux|Device:)' | egrep -v '^$'`
javaProcessList=`for i in ${AA};do echo ${i}#${i};done`
echo "{\"data\":["
first=1
for javaProcess in $javaProcessList;
do
    IFS='#' read -r -a items <<< "$javaProcess";
    if [ $first == 1 ]; then
        echo "{\"{#JAVAPSNAME}\":\"${items[1]}\",\"{#JAVAPSPID}\":\"${items[0]}\"}";
        first=0
    else
        echo ",{\"{#JAVAPSNAME}\":\"${items[1]}\",\"{#JAVAPSPID}\":\"${items[0]}\"}";
    fi
done;
 
echo "]}";
